home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / tools / Castle Kit.lua < prev    next >
Text File  |  2009-09-15  |  2KB  |  51 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Castle Kit
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, August 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.castlekit={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.castlekit.gfx_wpn=loadgfx("weapons/castlekit.bmp")                            -- Weapon Image
  13. setmidhandle(cc.castlekit.gfx_wpn)
  14. cc.castlekit.gfx_stone=loadgfx("buildings/block.bmp")                            -- Block Image
  15. setmidhandle(cc.castlekit.gfx_stone)
  16. cc.castlekit.sfx_build=loadsfx("buildstone.ogg")                                -- Build Sound
  17.  
  18. --------------------------------------------------------------------------------
  19. -- Weapon: Castle Kit
  20. --------------------------------------------------------------------------------
  21.  
  22. cc.castlekit.id=addweapon("cc.castlekit","Castle Kit",cc.castlekit.gfx_wpn,0)    -- Add Weapon (0 uses)
  23. cc.castlekit.ammo=15                                                            -- Stones
  24.  
  25. function cc.castlekit.draw()                                                    -- Draw
  26.     -- HUD Positioning
  27.     if weapon_shots<cc.castlekit.ammo then
  28.         hudpositioning(pos_build,cc.castlekit.gfx_stone,250)
  29.     end
  30.     -- HUD ammobar
  31.     if cc.castlekit.ammo-weapon_shots>0 then
  32.         hudammobar(cc.castlekit.ammo-weapon_shots,cc.castlekit.ammo)
  33.     end
  34. end
  35.  
  36. function cc.castlekit.attack(attack)                                            -- Attack
  37.     if (weapon_shots<=cc.castlekit.ammo) and (weapon_position==1) then
  38.         weapon_position=0
  39.         -- No more weapon switching!
  40.         useweapon(0)
  41.         weapon_shots=weapon_shots+1
  42.         -- Draw
  43.         terrainimage(cc.castlekit.gfx_stone,weapon_x,weapon_y)
  44.         -- Sound
  45.         playsound(cc.castlekit.sfx_build)
  46.         -- End Turn?
  47.         if (weapon_shots>=cc.castlekit.ammo) then
  48.             endturn()
  49.         end
  50.     end
  51. end